package databases;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class WebService {

	public String executar(String sURL){
		URL url;
		HttpURLConnection connection = null;
		BufferedReader content = null;
		try {
			url = new URL("http://192.168.3.34/falaiWS/" + sURL);

			connection = (HttpURLConnection) url.openConnection();
			content = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			
			String line = null;
			String retorno = "";
			while((line=content.readLine())!=null){
				retorno = retorno + line;
			}
			return retorno;
			
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			connection.disconnect();
		}
	}
	
}
